﻿//load
function load(id) {
	var js=document.scripts;
	var jsPath;
	for(var i=js.length;i>0;i--){
		if(js[i-1].src.indexOf("Function.js")>-1){
			jsPath=js[i-1].src.substring(0,js[i-1].src.lastIndexOf("/")+1);
			jsPath=jsPath.replace("Style/","");
		}
	}
	var doc = document.getElementById(id);
	if (id == 'aja' || id == 'flo') {
		if (id == 'aja') { //document.body.scrollTop
			var widthaja = (document.documentElement.scrollWidth - 680 - 30) / 2;
			doc.style.left = widthaja + 'px';
			doc.style.top = (document.documentElement.scrollTop + 90) + 'px';
			doc.innerHTML = '<div id="ajatitle"><span>Loading...</span><img src="' + jsPath + 'Images/close.gif" class="os" onclick="display(\'aja\')"/></div><div id="load"><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>Loading...</div>';
		}
		else {
			var widthflo = (document.documentElement.scrollWidth - 360 - 30) / 2;
			doc.style.left = widthflo + 'px';
			doc.style.top = (document.documentElement.scrollTop + 190) + 'px';
			if (is != 0) {
				doc.innerHTML = '<div id="flotitle"><span>Loading...</span><img src="' + jsPath + 'Images/close.gif" class="os" onclick="display(\'aja\')"/></div><div id="flomain">Loading...</div>';
			}
		}
	}
	else {
		doc.innerHTML = '<img class=""os"" src="' + jsPath + 'Images/load.gif"/>';
	}
}
//posthtm
function posthtm(url, id, verbs, is) { //is null or 1
	var js=document.scripts;
	var jsPath;
	for(var i=js.length;i>0;i--){
		if(js[i-1].src.indexOf("Function.js")>-1){
			jsPath=js[i-1].src.substring(0,js[i-1].src.lastIndexOf("/")+1);
			jsPath=jsPath.replace("Style/","");
		}
	}
	var doc = document.getElementById(id);
	load(id);
	//	doc.innerHTML='<span><img src="' + jsPath + 'Images/load.gif"/>Loading...</span>';
	var xmlhttp = false;
	if (doc != null) {
		doc.style.visibility = "visible";
		if (doc.style.visibility == "visible") {
			xmlhttp = ajax_driv();
			xmlhttp.open("POST", url, true);
			xmlhttp.setRequestHeader("If-Modified-Since", "Thu, 01 Jan 1970 00:00:00 GMT");
			xmlhttp.onreadystatechange = function() {
				if (xmlhttp.readyState == 4) {
					if (is || is == null) {
						doc.innerHTML = xmlhttp.responseText;
					}
					else {
						var data = {};
						data = eval('(' + xmlhttp.responseText + ')');
						doc.innerHTML = data.main;
						eval(data.js);
					};
				}
			}
			xmlhttp.setRequestHeader("Content-Length", verbs.length);
			xmlhttp.setRequestHeader("CONTENT-TYPE", "application/x-www-form-urlencoded");
			xmlhttp.send(verbs);
		}
	}
}
//display  *** Copyright &copy jinyushiji.com All Rights Reserved ***
function display(id) {
	var doc = document.getElementById(id);
	if (doc != null) {
		doc.style.visibility = "hidden";
	}
}
//ajax_driv  *** Copyright &copy jinyushiji.com All Rights Reserved ***
function ajax_driv() {
	var xmlhttp;
	if (window.ActiveXObject) {
		/* 不要删除以下注释，这部分不是注释 */
		/*@cc_on @*/
		/*@if (@_jscript_version >= 5)
		try {
		  xmlhttp = new ActiveXObject("Msxml2.xmlhttp");
		} catch (e) {
		  try {
			xmlhttp = new ActiveXObject("Microsoft.xmlhttp");
		  } catch (e) {
			xmlhttp = false;
		  }
		}
		@end @*/
	} else {
		xmlhttp = new XMLHttpRequest();
	}
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}